package com.yuw.tests;

import com.yuw.Teacher.Teacher;
import com.yuw.service.Student;
import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestDriver {
    @Test
    public void test01(){
        //创建spring对象的上下文对象，通过该对象对spring容器中的javabean进行管理，对pojo类进行管理
        ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
        //通过spring容器获取spring容器所管理的Javabean对象的实例
        Student stu0 = context.getBean("Student", Student.class);
        System.out.println("调用可以触发aop的方式动作：");
        stu0.doStudios();
        System.out.println("-----------------");
        stu0.saveMe();
        System.out.println("-------------------");
        Teacher tea0 = context.getBean("Teacher",Teacher.class);
        tea0.sayHello();
    }
}
